package com.timguan.render.dao.persistence.cms.ext;

import com.timguan.render.dao.persistence.cms.CmsDataDOSqlProvider;
import com.timguan.render.dataapi.domain.CmsDataDOExample;
import org.apache.ibatis.jdbc.SQL;

/**
 * Created by gkq on 15/8/21.
 */
public class CmsDataDOSqlProviderExt extends CmsDataDOSqlProvider {
    /**
     * 获取列表中最大的权重值
     */
    public String maxWeight(CmsDataDOExample example) {
        SQL sql = new SQL();
        sql.SELECT("max(weight)").FROM("cms_data");
        applyWhere(sql, example, false);
        return sql.toString();
    }

    /**
     * 获取列表中最小的权重值
     */
    public String minWeight(CmsDataDOExample example) {
        SQL sql = new SQL();
        sql.SELECT("min(weight)").FROM("cms_data");
        applyWhere(sql, example, false);
        return sql.toString();
    }
}
